<template>
  <div class="shop-header">
    <nav class="shop-nav" :style="{backgroundImage:`url(${info.bgImg})`}">
      <a class="back" @click="$router.back()">
        <i class="el-icon-arrow-left"></i>
      </a>
    </nav>
    <div class="head-container">
      <div class="shop-img">
        <img :src="info.avatar" alt="">
      </div>
      <div class="shop-title" @click="showtab">
        <div class="title">{{info.name}}</div>
        <i class="el-icon-caret-right"></i>
      </div>
      <div class="shop-detail">
        <span>{{info.score}}</span>
        <span>月售{{info.sellCount}}单</span>
        <span>专送</span>
        <span>约{{info.deliveryTime}}分钟</span>
        <span>距离{{info.distance}}米</span>
      </div>
      <div class="shop-pro" v-if="info.supports">
        <span>{{info.supports[0].content}}</span>
        <div class="discount-right">{{info.supports.length}}个优惠</div>
      </div>
    </div>
    <div class="shop-brief-modal" v-show="shopShow">
      <div class="brief-modal-content">
        <h2 class="content-title">
          <span class="content-tag">
            <span class="mini-tag">品牌</span>
          </span>
          <span class="content-name">{{info.name}}</span>
        </h2>
        <div class="content-detail">
          <div class="content-detail-item">
            <span>{{info.score}}</span>
            <span>评分</span>
          </div>
          <div class="content-detail-item">
            <span>{{info.sellCount}}单</span>
            <span>月售</span>
          </div>
          <div class="content-detail-item">
            <span>xx专送</span>
            <span>约{{info.deliveryTime}}分钟</span>
          </div>
          <div class="content-detail-item">
            <span>{{info.deliveryPrice}}元</span>
            <span>配送费用</span>
          </div>
          <div class="content-detail-item">
            <span>{{info.distance}}m</span>
            <span>距离</span>
          </div>
        </div>
        <div class="announcement">
          <span>- - -</span>
          <span>公告</span>
          <span>- - -</span>
        </div>
        <div class="text">
          {{info.bulletin}}
        </div>
        <div class="mask-footer" @click="toggleShopShow">
          <span class="el-icon-close"></span>
        </div>
      </div>
    </div>
  </div>
  
</template>

<script>
import {mapState} from 'vuex'
export default {
  data () {
    return {
      shopShow:false,

    }
  },
  methods:{
    showtab(){
      this.shopShow = !this.shopShow
    },
    toggleShopShow(){
      this.shopShow = false
    }
  },
  computed:{
    ...mapState(['info'])
  }
}
</script>

<style lang="less" scoped>
.shop-header{
  height: 100%;
  position: relative;
  background: #fff;
  color: rgb(144, 142, 142);
  .shop-nav{
    background-size: cover;
    background-repeat: no-repeat;
    height: 40px;
    padding: 5px 10px;
    position: relative;
    .back{
      position: absolute;
      top: 10px;
      left: 0;
      .el-icon-arrow-left{
        display: block;
        padding: 5px;
        font-size: 20px;
        color: lightgray
      }
    }
  }
  .head-container{
    padding: 30px 20px 5px 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    .shop-img{
      
      img{
        box-shadow: 0 0 0.4vw 0 rgba(0, 0, 0, .2);
        position: absolute;
        top: 0;
        left: 50%;
        width: 66px;
        height: 66px;
        border-radius: 2px;
        margin-left: -33px;
        margin-top: -40px;
      }
    }
    .shop-title{
      display: flex;
      text-align: center;
      justify-content: center;
      color: black;
      margin-bottom: 5px;
      .title{
        font-weight: 700;
        text-align: left;
        overflow: hidden;
        text-overflow: ellipsis;
        
        &::before{
          content: '品牌';
          font-size: 13px;
          padding: 1px 3px;
          background: rgb(241, 241, 88);
          margin-right: 4px;
          border-radius: 3px;
          line-height: 100%;
        }
      }
      .el-icon-caret-right{
        width: 20px;
        position: relative;
        height: 16px;
        color: black;
      }
    }
    .shop-detail{
      position: relative;
      text-align: center;
      font-size: 13px;
      margin-bottom: 8px;
      margin-top: 8px;
      color: rgb(134, 132, 132);

    }
    .shop-pro{
      border: 1px solid lightgray;
      padding: 3px;
      border-radius: 2px;
      display: flex;
      margin-top: 4px;
      span{
        font-size: 10px;
        &::before{
          content: '首单';
          background: rgb(113, 187, 2);
          color: white;
          padding: 1px 3px;
          font-size: 10px;
          border-radius: 3px;
          margin-right: 4px;
        }
      }
      .discount-right{
        width: 50px;
        flex-shrink: 0;
        position: relative;
        padding-right: 8px;
        text-align: right;
        font-size: 10px;
        &::after{
          content: "";
          display: block;
          border-style: solid;
          border-width: 4px 4px 0;
          border-color: rgba(0, 0, 0, .57) transparent transparent;
          position: absolute;
          top: 50%;
          transform: translateY(-50%);
          right: 0;
        }
          
      }
    }
  }
  .shop-brief-modal{
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    z-index: 52;
    background-color: rgba(0, 0, 0, .5);
    .brief-modal-content{
      width: 80%;
      position: relative;
      padding: 25px 20px;
      border-radius: 5px;
      background: #fff;
      z-index: 99;
      display: flex;
      flex-direction: column;
      margin-left: 15px;
      .content-title{
        font-size: 20px;
        line-height: 24px;
        font-weight: 700;
        white-space: nowrap;
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        color: black;
          .content-tag{
            width: 36px;
            height: 15px;
            margin-right: 5px;
            padding-bottom: 5px;
            background: rgb(237, 237, 25);
            color: #6a3709;
            position: relative;
            border-radius: 2px;
            .mini-tag{
              position: absolute;
              top: 0;
              left: 0;
              right: -100%;
              bottom: -100%;
              font-size: 24px;
              transform: scale(.5);
              transform-origin: 0 0;
              display: flex;
              justify-content: center;
              align-items: center;
            }
            .content-name{
              font-weight: 700;
              font-size: 18px;
              color: black;
            }
          }
        
      }
      .content-detail{
        display: flex;
        justify-content: space-around;
        align-items: center;
        .content-detail-item{
          display: flex;
          flex-direction: column;
          align-items: center;
          span:first-child{
            color: black;
            font-weight: 600;
            margin: 10px 0;
          }
          span:last-child{
            font-size: 15px;
            margin-bottom: 10px;
          }
        }
      }
      .announcement{
        margin-bottom: 15px;
        margin-top: 5px;
      }
      .text{
        font-size: 13px;
        line-height: 1.54;
        color: #333;
        overflow-y: auto;
      }
      .mask-footer{
        position: absolute;
        bottom: -60px;
        left: 50%;
        padding: 6px;
        border: 1px solid rgba(255, 255, 255, .7);
        border-radius: 50%;
        transform: translateX(-50%);
        span{
          color: white;
        }
      }
    }
  }
}
</style>